package com.fub.util.database.databaseHelper;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class WallsDatabaseManager extends SQLiteOpenHelper {

	public static final String TABLE_NAME_WALLS = "walls";
	public static final String BUILDING_ID_COL = "building_id";
	public static final String COL_ID = "_id";
	public static final String COL_X1 = "x1";
	public static final String COL_Y1 = "y1";
	public static final String COL_X2 = "x2";
	public static final String COL_Y2L = "y2";
	public static final String COL_Z = "z";
	private static final String DATABASE_NAME = "walls.db";
	private static final int Version = 2;
	private static final String CREATE_TABLE_WALLS = String
			.format("create table %s (%s  integer primary key autoincrement, %s text not null, %s  integer not null, %s integer not null, %s integer not null, %s integer not null, %s integer not null);",
					TABLE_NAME_WALLS, COL_ID, BUILDING_ID_COL, COL_X1, COL_Y1,
					COL_X2, COL_Y2L, COL_Z);

	public WallsDatabaseManager(Context context) {
		super(context, DATABASE_NAME, null, Version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_TABLE_WALLS);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME_WALLS);
		onCreate(db);
	}
}
